﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/demo.css" />
<script src="${pageContext.request.contextPath}/script/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/script/jquery.easyui.min.js"></script>
<script src="${pageContext.request.contextPath}/script/easyui-lang-zh_CN.js"></script>

<title>登录</title>
<style type="text/css">

body{margin:0;padding:0}

.STYLE1 {
	color: #ffffff;
	font-size: 12px;
}
.STYLE4 {
	color: #8da8c3;
	font-size: 12px;
}
.STYLE6 {
	font-size: 12px;
	color: #5593ce;
}

</style>

<script>
				function login(){
		    		var username=$("#username").val();
					var password=$("#password").val();
					var res = verifyCode.validate(document.getElementById("code_input").value);
					if(!username){
		    				alert("用户名不能为空");
		    		}else if(!password){
		    				alert("密码不能为空");
		    		}
		    		$.ajax({
		    			url:"${pageContext.request.contextPath}/login/login",
		    			type:"post",
		    			data:{
		    					"username":username,
		    					"password":password,
		    					},
		    			dataType:"json",
		    			
		    			success:function(data){
		    			//alert(data.msg);return;
		    			if(res){
							alert("验证正确");
						if(data.username == "admin" && data.password=="admin"){
		    				alert("您是管理员");
		    				window.location.href="${pageContext.request.contextPath}/admin/adminindex";	
		    			}else if(data.username == "root" && data.password=="root"){
		    				alert("您是快递员");
		    				window.location.href="${pageContext.request.contextPath}/courier/courierindex";
		    			}else{
		    				window.location.href="${pageContext.request.contextPath}/user/index";
		    			}	
						}else{
							alert("验证错误");
							window.location.reload(); 
						}
		    			
		    			/* if(data.username == "admin" && data.password=="admin"){
		    				alert("您是管理员");
		    				window.location.href="${pageContext.request.contextPath}/admin/adminindex";	
		    			}else
		    				window.location.href="${pageContext.request.contextPath}/user/index"; */			
		    			},
		    			error:function(){
		    				alert("账号或密码错误！！！");
		    				window.location.reload(); 
		    			}
		    		});
		    		
		    	}
	
	
		
</script>

</head>

<body>
<table width="100%" height="1024" border="0" align="center" cellpadding="0" cellspacing="0"  style="margin:0px; padding:0px">
  <tr>
    <td height="594"  align="center" valign="top" background="${pageContext.request.contextPath}/images/bj.gif">
	<table width="465" height="414" border="0" align="center" cellpadding="0" cellspacing="0" >
      <tr>
        <td  height="152" colspan="3" valign="bottom"><img src="${pageContext.request.contextPath}/images/toplogin.png" width="460" height="155" /></td>
      </tr>
      <tr>
        <td width="15" height="262" background="${pageContext.request.contextPath}/images/bj1.gif">&nbsp;</td>
        <td width="420" valign="middle" background="${pageContext.request.contextPath}/images/bj2.gif">
	<form name="form1" method="post" action="" onsubmit="return check();">
		<table width="100%" height="170" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="31%" align="right"><span class="STYLE1">用户名：</span></td>
              <td colspan="3" align="left"><label>
                <input id="username" type="text" class="easyui-textbox" data-options="required:true,missingMessage:'用户名必填!' " />
              </label></td>
            </tr>
            <tr>
              <td align="right"><span class="STYLE1">密&emsp;码：</span></td>
              <td colspan="3" align="left"><label>
                <input id="password" type="text" class="easyui-textbox" data-options="required:true,missingMessage:'密码必填!' " />
              </label></td>
            </tr>
          
            <tr>
            <td align="right">
            	<span class="STYLE1">验证码：</span>
            </td>
            <td align="left">
             <label>
                <input type="text" id="code_input" size="4" class="easyui-textbox" data-options="required:true,missingMessage:'此项必填!' " />
             </label>
             </td>
            	<td align="left"><div id="v_container" style="margin-left:50px;width: 140px;height: 40px;cursor:pointer;"></div></td>
            	<!-- <td align="left"><input type="button" id="my_button" value="验证"/></td> -->
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td width="15%" valign="top"><p class="STYLE4">&nbsp;</p></td>
              <td width="20%" align="right" valign="middle">
              	<a href="${pageContext.request.contextPath}/login/zhuce" ><img src="${pageContext.request.contextPath}/images/zcxyh.gif"/></a>
              	<br />
                  <br />
              <td width="34%" height="55" align="left"> 
			  <a type="button" class="easyui-linkbutton" iconCls="icon-ok" onclick="login()" />登录</a>
			  </td>
            </tr>
        </table>
		 </form>		</td>
        <td width="13" background="${pageContext.request.contextPath}/images/bj3.gif">&nbsp;</td>
      </tr>
    </table>
	<table width="100%" height="9%" border="0" cellpadding="0" cellspacing="0">
     
    </table>
	<br />
	<table width="100%" height="4%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="4%" align="center" valign="middle"><span class="STYLE6">版权所有：Hcx天行猫速运 <br />
              <br />
          <a href="http://www.hcx520.com"><span>友情链接:www.hcx520.com</span></a></td>
      </tr>
    </table></td>
  </tr>
</table>

<script src="${pageContext.request.contextPath}/js/gVerify.js"></script>
<script>
		var verifyCode = new GVerify("v_container");
		
		 /* document.getElementById("my_button").onclick = function(){
			var res = verifyCode.validate(document.getElementById("code_input").value);
			if(res){
				alert("验证正确");
			}else{
				alert("验证错误");
			}
		};  */
</script>
</body>
</html>
